package com.lb.io.heima.bio.three;

import java.io.*;
import java.net.Socket;

/**
 * @ClassName ServerThreadReader
 * @Author LB
 * @Date 2021/12/17 11:25
 **/
public class ServerThreadReader extends Thread{

    private Socket socket;

    public ServerThreadReader(Socket socket){
        this.socket = socket;
    }

    @Override
    public void run() {
        try {
            InputStream inputStream = socket.getInputStream();
            BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
            String line ;
            while ((line = br.readLine())!=null){
                System.out.println("服务端收到："+line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}